<?php

namespace SummoIngenio\Sai\MatematicaBundle\Utility\Juego\P0;
use SummoIngenio\Sai\MatematicaBundle\Utility\Juego\JuegoBase;
define('CANT_PROBLEMAS', 5);
/**
 * Description of P01035
 *
 * @author SVM
 */

class P01035 extends JuegoBase {
  
  public function init() {
	$this->base = rand(10,19);
	$l =  array();
	
	$this->n1 = rand(1,20-$this->base);
	$this->n2 = rand(3,5);
	
	$this->n3 = rand(1,$this->n2);
	$this->n4 = rand(0,$this->n3);
  }
  
  public function getPregunta() {
    return '';
  }
  public function getHtmlDesactivado() {	
    return $this->render('P0/P01035/desactivado', array(
        'n1'   =>  $this->n1,		
        'n2'   =>  $this->n2,
        'n3'   =>  $this->n3,		
        'n4'   =>  $this->n4,
        'base'   =>  $this->base,		
      ));
  }
  
  public function getHtmlJugable() {
    return $this->render('P0/P01035/jugable', array(
        'n1'   =>  $this->n1,		
        'n2'   =>  $this->n2,
        'n3'   =>  $this->n3,		
        'n4'   =>  $this->n4,
        'base'   =>  $this->base,	
      ));
  }
  
  public function getHtmlResuelto() {
    return $this->render('P0/P01035/resuelto', array(
        'n1'   =>  $this->n1,		
        'n2'   =>  $this->n2,
        'n3'   =>  $this->n3,		
        'n4'   =>  $this->n4,
        'base'   =>  $this->base,
      ));
  }
  
  public function verificarRespuesta($respuestaUsuario) {
     $rsp = true;
	 
	 if($respuestaUsuario->get('valor1')!=$this->base+$this->n1){ 
	   $rsp=false;
	 }
	 if($respuestaUsuario->get('valor2')!=$this->base+$this->n1-$this->n2){ 
	   $rsp=false;
	 }
	 if($respuestaUsuario->get('valor3')!=$this->base+$this->n1-$this->n2+$this->n3){ 
	   $rsp=false;
	 }	 
    $aRetornar = array(
      'respuesta' => '',
      'correcta'  => $rsp,
    );
    return $aRetornar;
  }

  public function getJavascript() {
    $aRetornar = array(
      "tipo"      => "archivo",
      "contenido" => "P0/P01035.js"
    );
    return $aRetornar;
  }

  public function getCss() {
    $aRetornar = array(
      "tipo"      => "archivo",
      "contenido" => "P0/P01035.css"
    );
    return $aRetornar;
  }

  public function __sleep() {
    return array(
        'base',
        'n1',		
        'n2',
        'n3',	
        'n4',		
    );
  }
}

?>